#!/bin/bash
#

##对比两个目录下文件的差异，针对复制  1)丢失文件 2)内容不一致

#cp -ra /opt/bj/* /opt/sh

for file in $(find /opt/bj -type f); do
    new_file=${file/bj/sh}
    if [ ! -e "${new_file}" ]; then
	echo "文件${new_file}不存在"
    else
	diff ${file} ${new_file} &> /dev/null
        if [ $? -ne 0 ]; then
	    echo "文件${file}与文件${new_file}的内容不一致"
	fi
    fi
done
